package com.yaoge.ssm.controller;

import com.yaoge.ssm.bean.Student;
import com.yaoge.ssm.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class TestSSMController {

    @Autowired
    private StudentService service;
    @RequestMapping("/students")
    public String getAllStudent(Model model){
        List<Student> students = service.searchAll();
        model.addAttribute("students",students);
        return "show";


    }
}
